﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace AirlineSystemApp
{
    public class ScheduleFlightProduct
    {
        private int _index;

        public int Index
        {
            get { return _index; }
            set { _index = value; }
        }
        private ScheduledFlight _ScheduledFlight;

        public  ScheduledFlight ScheduledFlight
        {
            get { return _ScheduledFlight; }
            set { _ScheduledFlight = value; }
        }
        private List<ScheduledFlight> _ScheduledFlightList;

        public List<ScheduledFlight> ScheduledFlightList
        {
            get { return _ScheduledFlightList; }
            set { _ScheduledFlightList = value; }
        }
        private BindingSource _bsScheduledFlight;

        public BindingSource BsScheduledFlight
        {
            get
            {
                if (_bsScheduledFlight == null)
                    _bsScheduledFlight = new BindingSource();
                return _bsScheduledFlight;
            }
            set { _bsScheduledFlight = value; }
        }
        private TextBox _txtFlightNo;

        public TextBox txtFlightNo
        {
            get
            {
                if (_txtFlightNo == null)
                    _txtFlightNo = new TextBox();
                return _txtFlightNo;
            }
            set { _txtFlightNo = value; }
        }
        private TextBox _txtFirstClassSeat;

        public TextBox txtFirstClassSeat
        {
            get
            {
                if (_txtFirstClassSeat == null)
                    _txtFirstClassSeat = new TextBox();
                return _txtFirstClassSeat;
            }
            set { _txtFirstClassSeat = value; }
        }
        private DateTimePicker _dtpFlightDate;

        public DateTimePicker DtpFlightDate
        {
            get 
            {
                if (_dtpFlightDate == null)
                    _dtpFlightDate = new DateTimePicker();
                return _dtpFlightDate; 
            }
            set { _dtpFlightDate = value; }
        }
        private TextBox _txtBusinessClassSeat;
        public TextBox txtBusinessClassSeat
        {
            get
            {
                if (_txtBusinessClassSeat == null)
                    _txtBusinessClassSeat = new TextBox();
                return _txtBusinessClassSeat;
            }
            set { _txtBusinessClassSeat = value; }
        }
        private TextBox _txtEconomyClassSeat;
        public TextBox txtEconomyClassSeat
        {
            get
            {
                if (_txtEconomyClassSeat == null)
                    _txtEconomyClassSeat = new TextBox();
                return _txtEconomyClassSeat;
            }
            set { _txtEconomyClassSeat = value; }
        }
        public void Show()
        {
            BsScheduledFlight.DataSource = _ScheduledFlightList;
            txtFlightNo.Text = _ScheduledFlight.FlightNo;
            DtpFlightDate.Value = _ScheduledFlight.FlightDate;
            txtFirstClassSeat.Text = _ScheduledFlight.FirstClassSeatsAvailable.ToString();
            txtBusinessClassSeat.Text = _ScheduledFlight.BusinessClassSeatsAvailable.ToString();
            txtEconomyClassSeat.Text = _ScheduledFlight.EconomyClassSeatsAvailable.ToString();
        }
    }
}
